package project.menu.mainmenu;

import project.controllers.Messager;
import project.controllers.Printer;
import project.menu.IMenu;
import project.menu.IMenuItem;
import project.work.Navigator;
import controllers.IAutoservice;

public class ResaveData implements IMenuItem {

	private String name = "Resave data";
	private final Integer id = 4;
	private static IMenu submenu;
	private Navigator navigator;

	public ResaveData() {
		navigator = Navigator.getInstance();
	}

	public static void setSubmenu(IMenu menu) {
		submenu = menu;
	}

	public void action(IAutoservice autoservice) {
		// resave data
		autoservice.resaveData();
		Printer.printMessage(Messager.DATA_SAVE_SUCCESS);
		navigator.drawMenu(submenu);
		
	}

	public String getNameItem() {
		return name;
	}

	public Integer getId() {
		return id;
	}

}
